package com.shahe.GirlsDay.util;

import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

public class UserInfo {
	private int userid = 0;
	private String username = " ";
	private String password = " ";
	private String givenname = " ";
	private String surname = " ";
	private String email = " ";
	private String defaultlength = "7";
	private String cycledays = "35";
	private String ovulation = "11";

	public UserInfo() {
	}

	public UserInfo(JSONObject json) throws JSONException {
		this.userid = json.getInt("userid");
		this.username = json.getString("username");
		this.password = json.getString("password");
		this.givenname = json.getString("givenname");
		this.surname = json.getString("surname");
		this.email = json.getString("email");
		this.defaultlength = json.getString("defaultlength");
		this.cycledays = json.getString("cycledays");
		this.ovulation = json.getString("ovulation");
	}

	public int getUserid() {
		return userid;
	}

	public void setUserid(int userid) {
		this.userid = userid;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getGivenname() {
		return givenname;
	}

	public void setGivenname(String givenname) {
		this.givenname = givenname;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDefaultlength() {
		return defaultlength;
	}

	public void setDefaultlength(String defaultlength) {
		this.defaultlength = defaultlength;
	}

	public String getCycledays() {
		return cycledays;
	}

	public void setCycledays(String cycledays) {
		this.cycledays = cycledays;
	}

	public String getOvulation() {
		return ovulation;
	}

	public void setOvulation(String ovulation) {
		this.ovulation = ovulation;
	}

	public JSONObject toJson() throws JSONException {
		JSONObject json = new JSONObject();		
		json.put("userid", this.getUserid());
		json.put("username", this.getUsername());
		json.put("password", this.getPassword());
		json.put("givenname", this.getGivenname());
		json.put("surname", this.getSurname());
		json.put("email", this.getEmail());
		json.put("phone", "0410462233");
		json.put("defaultlength", this.getDefaultlength());
		json.put("cycledays", this.getCycledays());
		json.put("ovulation", this.getOvulation());
		return json;

	}
}
